local skel = fk.CreateSkill {
  name = "lb_zero__jianshan",
}

Fk:loadTranslationTable {
  ["lb_zero__jianshan"] = "剑闪",
  [":lb_zero__jianshan"] = "每回合限一次，你可将手牌中一张【闪】重铸，以抵消以你为目标的牌。",

  ["#lb_zero__jianshan"] = "剑闪：你可以重铸一张【闪】，以抵消 %arg",

  ["$lb_zero__jianshan1"] = "胜负…差不多该收尾了！",
  ["$lb_zero__jianshan2"] = "以泰姆菲尔德之名，我绝不会输！",
}

skel:addEffect(fk.PreCardEffect, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and player == data.to and not data.isCancellOut
    and not player:isKongcheng() and player:usedSkillTimes(skel.name) == 0
  end,
  on_cost = function (self, event, target, player, data)
    local cards = player.room:askToCards(player, {
      min_num = 1,
      max_num = 1,
      skill_name = skel.name,
      cancelable = true,
      include_equip = true,
      pattern = "jink",
      prompt = "#lb_zero__jianshan:::" .. data.card:toLogString()
    })
    if #cards > 0 then
      event:setCostData(self, {cards = cards})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    data.isCancellOut = true
    player.room:recastCard(event:getCostData(self).cards, player, skel.name)
  end,
})

return skel
